07. Training and Validation

Training, Predicting and Scoring

Now that you have collected your data and built your network, it's time to train your data and test its performance on the validation set.

Note: Training CNNs is a very compute-intensive process. If your system does not have a recent Nvidia graphics card, with cuDNN and CUDA installed , you may need to perform the training step in the cloud.

Udacity provides you with a in Classroom Workspace with Jupyter Notebook and GPU support. It is in the Workspace - Follow Me concept. Note that you need to turn on the GPU mode when you are ready to train the model. You could also use AWS to train your network. Instructions for using AWS to train your network in the cloud may be found here

Training your Model

Prerequisites

  • Training data is in data directory
  • Validation data is in the data directory
  • The folders data/train/images/, data/train/masks/, data/validation/images/, and data/validation/masks/ should exist and contain the appropriate data

To train complete the TODO's in the model_training.ipynb notebook and then run the training cell with appropriate hyperparameters selected.

After the training run has completed, your model will be stored in the data/weights directory as an HDF5 file, and a configuration_weights file. As long as they are both in the same location, things should work.

Important Note the validation directory is used to store data that will be used during training to produce the plots of the loss, and help determine when the network is overfitting your data.

The sample_evalution_data directory contains data specifically designed to test the networks performance on the FollowME task. In sample_evaluation data are three directories each generated using a different sampling method. The structure of these directories is exactly the same as validation, and train datasets provided to you. For instance patrol_with_targ contains an images and masks subdirectory. If you would like to the evaluation code on your validation data a copy of the it should be moved into sample_evaluation_data, and then the appropriate arguments changed to the function calls in the model_training.ipynb notebook.

The notebook has examples of how to evaulate your model once you finish training. Think about the socring methods, and how the information provided in the evaluation sections relates to the final score. Then try things out seem like they may work.

Scoring

To score the network on the FollowMe task two types of error are measured. First the intersection over the union for the pixelwise classifications is computed for the target channel.

In addition to this we determine whether the network detected the target person or not. If more then 3 pixels have probability greater then 0.5 of being the target person then this counts as the network guessing the target is in the image.

We determine whether the target is actually in the image by whether there are more then 3 pixels containing the target in the label mask.

Using the above the number of detection true_positives, false positives, false negatives are counted.

How the Final Score is Calculated

The final score is the pixel wise:

average_IoU*(n_true_positive/(n_true_positive+n_false_positive+n_false_negative))

on data similar to that provided in sample_evaulation_data

Ideas for Improving your Score

Collect more data from the sim. Look at the predictions think about what the network is getting wrong, then collect data to counteract this. Or improve your network architecture and hyperparameters.

Obtaining a leaderboard score

Share your scores in slack, and keep a tally in a pinned message. Scores should be computed on the sample_evaluation_data. This is for fun, your grade will be determined on unreleased data. If you use the sample_evaluation_data to train the network, it will result in inflated scores, and you will not be able to determine how your network will actually perform when evaluated to determine your grade.

Example of looking at your predictions to see where more data may help!

Example of looking at your predictions to see where more data may help!